/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BO;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

/**
 *
 * @author Ymmot
 */
public class Controller {
    private EntityManager em;
    
    public Controller(){
        em = Persistence.createEntityManagerFactory("ToWaCommunityPU").createEntityManager();
    }
    
    public User validate(String username, String password){
        return (User) em.createQuery("SELECT u FROM User u WHERE u.username = '" + username + "' and u.password = '" + password + "'").getSingleResult();
    }
}
